package 我的Java学习_算法基础.day_05;

public class _070_巧妙翻转字符串 {
    public static void main(String[] args) {
        String s = "!remmargorP avaJ a m'I";
        String n = reverseString(s);
        System.out.println(n);
    }
    static String reverseString(String s){
        int length = s.length();
        char[] charArr = new char[length];
        for(int i =0;i<length;i++){
            charArr[i]=s.charAt(length-1-i);
        }
        return new String(charArr);
    }
    static String reverse(String s){
        StringBuffer buffer = new StringBuffer(s);
        return buffer.reverse().toString();
//        StringBuilder builder = new StringBuilder(s);
//        return builder.reverse().toString();

    }
}
